// CherryMerry ( Mikhail Tomilenko ), Reverse Entertainment, 2021-2024

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"

#include <NifestGame/Interfaces/Public/I_Core.h>
#include <NifestGame/UI/Gameplay/HUD/PlayerHUD.h>
#include <NifestGame/UI/Gameplay/Respawn/RespawnMenu.h>

#include "NF_Character.generated.h"

UCLASS()
class NIFESTGAME_API ANF_Character : public ACharacter, public II_Core
{
	GENERATED_BODY()

	UPROPERTY(VisibleAnywhere, meta = (AllowPrivateAccess = "true"))
	class UCameraComponent* Camera;

	UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = "true"), Category = "CharacterSettings | Components")
	class UPlayerHealthManager* HealthManager;

	UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = "true"), Category = "CharacterSettings | Components")
	class UPlayerLevelManager* LevelManager;

	UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = "true"), Category = "CharacterSettings | Components")
	class UPlayerUIManager* UIManager;

	UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = "true"), Category = "CharacterSettings | Components")
	class UPlayerMovementManager* MovementManager;

	UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = "true"), Category = "CharacterSettings | Components")
	class UPlayerCombatManager* CombatManager;

public:
	ANF_Character();

protected:
	virtual void BeginPlay() override;

public:
	virtual void Tick(float DeltaTime) override;

	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

protected:
	/* Movement functions */
	virtual void MoveForward(float Value);
	virtual void MoveRight(float Value);

	/* Functions */
	void UpdatePlayerSpeed_Implementation(float SpeedToSet, bool bCrouched);
	void Initialize_Implementation() override;
	virtual void UpdatePlayerComponentsAfterLVLUp();

	UFUNCTION(BlueprintCallable)
	void PlayerInteract();

	/* Variables */
	UPROPERTY(EditAnywhere, Category = "CharacterSettings | Interact")
	float InteractTraceLength;

	UPROPERTY(EditAnywhere, Category = "CharacterSettings | Movement")
	float StaminaDrainTime = 0.5f;

	UPROPERTY(EditAnywhere, Category = "CharacterSettings | Movement")
	float StaminaRefillTime = 1.5f;

	UPROPERTY(EditAnywhere, Category = "CharacterSettings | Movement")
	float DelayBeforeRefill = 80.f;

	/* UI Classes */
	UPROPERTY(EditAnywhere, Category = "CharacterSettings | UI")
	TSubclassOf<class URespawnMenu> RespawnMenu;

	UPROPERTY(EditAnywhere, Category = "CharacterSettings | UI")
	TSubclassOf<class UPlayerHUD> PlayerHUD;
};